package com.example.money.Controller;

import com.example.money.Entity.delete;
import com.example.money.Service.DeleteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class DeleteController {
    @Autowired
    private DeleteService deleteService;

    /**
     * 实现通过id删除的控制层
     */
    @PostMapping(value = "/delete")
    @ResponseBody
    public String delete(delete delete) {
        boolean i = deleteService.delete(delete);
        if (i) {
            System.out.println(delete+"删除成功！");
            return "删除成功！";
        } else {
            System.out.println(delete+"删除失败！");
            return "删除失败！";
        }
    }
}
